package com.blb.utils;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * 图标工具类
 */
public class IconfontUtils {


    /**
     * 获取所有图标的类名
     */
    public static List<String> getIconfont() throws IOException {
        ArrayList<String> list = new ArrayList<>();
        //返回demo_fontclass.html文件的html对象文档
        Document document = Jsoup.connect("http://localhost:8080/static/iconfont/demo_fontclass.html").get();
        Elements divs = document.getElementsByClass("fontclass");
        for (int i = 0; i < divs.size(); i++) {
            Element div = divs.get(i);
            String className = div.text().replace(".", "");
            list.add(className);
        }
        return list;
    }
}
